//1.位运算 --- 判定字符是否唯一
//解法: 整除充当哈希表
class Solution {
public:
    bool isUnique(string astr) {
        if(astr.size() > 26) return false;
        int hash = 0;
        for(auto x : astr) 
        {
            if((hash >> (x - 'a')) & 1)
                return false;
            hash |= (1 << (x - 'a'));
        }
        return true;
    }
};

//2.位运算 - 丢失的数字
class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int ret = 0;
        int n = nums.size();
        for(int i = 1; i <= n; i++) ret ^= i;
        for(int i = 0; i < n; i++) ret ^= nums[i];
        return ret;
    }
};